import java.util.Scanner;

public class Main1064 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int c = 0;
        int f = 0;
        for (int i = 1; i <= n; i++) {
            f = 0;
            for (int j = 2; j <= i - 1; j++) {
                if (i % j == 0) {
                    f++;
                    break;
                }
            }
            if (f == 0 && i > 1) {
                System.out.print(i + " ");
                c++;
                if (c % 5 == 0) {
                    System.out.print("\n");
                }
            }
        }
    }
}
